package com.manli.api.controller;

import java.util.Arrays;
import java.util.Map;
import com.manli.api.pojo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import com.manli.api.base.annotation.Permissions;
import com.manli.api.pojo.QueryParams;
import com.manli.api.dto.WeChatShareCutecat;
import com.manli.api.service.WeChatShareCutecatService;



/**
 * 自动通过微信好友
 *
 * @author manli
 * @email 
 * @date 2020-06-21 21:21:50
 */
@Api(value="/wechatsharecutecat", tags="自动通过微信好友")
@RestController
@RequestMapping("api/wechatsharecutecat")
public class WeChatShareCutecatController {
    @Autowired
    private WeChatShareCutecatService weChatShareCutecatService;

    /**
     * 列表
     */
    @ApiOperation(value = "自动通过微信好友列表",notes = "")
    @PostMapping("/list")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result list(@RequestBody QueryParams params){
        return weChatShareCutecatService.queryPage(params);
    }

    /**
     * 全部数据信息
     */
    @ApiOperation(value = "自动通过微信好友全部数据信息",notes = "")
    @PostMapping("/all")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result all(){
        return weChatShareCutecatService.queryAll();
    }

    /**
     * 单条信息
     */
    @ApiOperation(value = "自动通过微信好友单条信息",notes = "自动通过微信好友单条信息")
    @GetMapping("/info/{id}")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result info(@PathVariable("id") Integer id){
        return weChatShareCutecatService.getById(id);
    }

    /**
     * 保存
     */
    @ApiOperation(value = "自动通过微信好友保存",notes = "自动通过微信好友保存")
    @PostMapping("/save")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result save(@RequestBody WeChatShareCutecat weChatShareCutecat){
        return weChatShareCutecatService.save(weChatShareCutecat);
    }

    /**
     * 修改
     */
    @ApiOperation(value = "自动通过微信好友修改",notes = "自动通过微信好友修改")
    @PostMapping("/update")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result update(@RequestBody WeChatShareCutecat weChatShareCutecat){
        return weChatShareCutecatService.updateById(weChatShareCutecat);
    }


    /**
     * 删除多条数据
     */
    @ApiOperation(value = "自动通过微信好友删除",notes = "自动通过微信好友删除")
    @ApiImplicitParam(name = "ids", value = "id数组,json字符串",dataType = "id数组,json字符串", required = true)
    @PostMapping("/deleteIds")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result deleteIds(@RequestBody Integer[] ids){
        return weChatShareCutecatService.removeByIds(Arrays.asList(ids));
    }

}
